// function url(path) {
//   return "/local/" + path;
// }

function url(pathname) {
  return window.RPConfig['local'] + pathname;
}


export const superviseInfoAPI = {
  purchaseList: params => {
    return $http.post(url("/purchaser/page"), params).then(res => res.data);
  },
  purchaseDetail: params => {
    return $http.get(url("/purchaser/detail"), params).then(res => res.data);
  },
  dataExport: (params, path) => {
    return $http.post(url('/' + path), params, null, { responseType: "blob", timeout: 480000 });
  },
  subjectList: params => {
    return $http.post(url("/bid/page"), params).then(res => res.data);
  },
  subjectDetail: params => {
    return $http.get(url("/bid/detail"), params).then(res => res.data);
  },
  subjectExport: params => {
    return $http.post(url("/bid/export"), params, null, { responseType: "blob" });
  },
  offerList: params => {
    return $http.post(url("/supplier/page"), params).then(res => res.data);
  },
  offerDetail: params => {
    return $http.get(url("/supplier/detail"), params).then(res => res.data);
  },
  offerExport: params => {
    return $http.post(url("/supplier/export"), params, null, { responseType: "blob" });
  },
  contractList: params => {
    return $http.post(url("/contract/page"), params).then(res => res.data);
  },
  contractDetail: params => {
    return $http.get(url("/contract/detail"), params).then(res => res.data);
  },
  contractExport: params => {
    return $http.post(url("/contract/export"), params, null, { responseType: "blob" });
  },
  buyerList: params => {
    return $http.post(url("/buyer/page"), params).then(res => res.data);
  },
  buyerDetail: params => {
    return $http.get(url("/buyer/detail"), params).then(res => res.data);
  },
  buyerExport: params => {
    return $http.post(url("/buyer/export"), params, null, { responseType: "blob" });
  },
  sellerList: params => {
    return $http.post(url("/seller/page"), params).then(res => res.data);
  },
  sellerDetail: params => {
    return $http.get(url("/seller/detail"), params).then(res => res.data);
  },
  sellerExport: params => {
    return $http.post(url("/seller/export"), params, null, { responseType: "blob" });
  },
  performanceList: params => {
    return $http.post(url("/agree/page"), params).then(res => res.data);
  },
  performanceDetail: params => {
    return $http.get(url("/agree/detail"), params).then(res => res.data);
  },
  performanceExport: params => {
    return $http.post(url("/agree/export"), params, null, { responseType: "blob" });
  },
  invoiceList: params => {
    return $http.post(url("/invoice/page"), params).then(res => res.data);
  },
  invoiceDetail: params => {
    return $http.get(url("/invoice/detail"), params).then(res => res.data);
  },
  invoiceExport: params => {
    return $http.post(url("/invoice/export"), params, null, { responseType: "blob" });
  },
  importExcel: (params, path) => {
    return $http.post(url("/" + path), params, null, { headers: { "Content-Type": "multipart/form-data" } });
  },
  postReport: (params, path) => {
    return $http.post(url("/" + path), params).then(res => res.data);
  },
  getHistory: (params, path) => {
    return $http.post(url('/' + path), params).then(res => res.data)
  },
  getHistoryDetail: (params, path) => {
    return $http.get(url('/' + path), params).then(res => res.data)
  },
  getAbnormalData: (params) => {
    return $http.post(url('/outlier_data/page'), params).then(res => res.data)
  },
  abnormalExport: (params) => {
    // return $htt
  },
  getValueList: (params) => {
    return $http.get(url('/value/item/list'), params).then(res => res.data)
  },
  // 分页查询调度配置信息
  getDispatchConfigList(params) {
    return $http.post(url('/dispatch/page'), params).then(res => res.data)
  },
  // 新增调度配置信息
  addDispatchConfig(params) {
    return $http.post(url('/dispatch/add'), params)
  },
  // 查询最新有效调度配置信息
  getDispatchConfig() {
    return $http.get(url('/dispatch/data'))
  },
  getUseList(params) {
    return $http.post(url('/purview/page'), params).then(res => res.data)
  },
  addPurview(params) {
    return $http.post(url('/purview/add'), params)
  },
  purviewDetail(params) {
    return $http.get(url('/purview/detail'), params).then(res => res.data)
  },
  editPurview(params) {
    return $http.post(url('/purview/edit'), params).then(res => res.data)
  },
  deletePurview(params) {
    return $http.post(url('/purview/delete'), params).then(res => res.data)
  },
  editDetail(params, path) {
    return $http.post(url("/" + path), params).then(res => res.data)
  },
  submitDetail(params, path) {
    return $http.post(url("/" + path), params).then(res => res.data)
  },
  reSubmit(params) {
    return $http.post(url('/bpmn/flowable/process/submit'), params).then(res => res.data)
  },
  getFlowImage(params) {
    return $http.post(url('/bpmn/flowable/process/image'), params).then(res => res.data)
  },
  getFlowHistory(params) {
    return $http.post(url('/bpmn/flowable/process/comment/list'), params).then(res => res.data)
  },
  detailPage(params, path) {
    return $http.get(url("/" + path), params).then(res => res.data)
  },
  getFileUrl(params) {
    return $http.get(url('/file/getCrsrmUrl'), params).then(res => res.data)
  },
  getCurrentSysInfo(params) {
    return $http.get(url('/purview/getUserData'), params).then(res => res.data)
  },
  getMiddlegroundUserInfo() {
    return $http.post('apis/mgt/security/getLoginData').then(res => res.data)
  },
  canRevoke(params) {
    return $http.post(url('/bpmn/flowable/process/undo/check'), params).then(res => res.data)
  },
  revoke(params) {
    return $http.post(url('/bpmn/flowable/process/undo'), params).then(res => res.data)
  },
  approvalHandle(params) {
    return $http.post(url('/bpmn/flowable/process/task/pass'), params).then(res => res.data)
  },
  getFlowData(params) {
    return $http.post(url('/bpmn/flowable/process/current/node'), params).then(res => res.data)
  },
  reject(params) {
    return $http.post(url('/bpmn/flowable/process/task/reject'), params).then(res => res.data)
  },
  downloadBatch(params) {
    return $http.get(url('/purchaser/download'), params, null, { responseType: "blob" })
  },
  toRead(params, path) {
    return $http.post(url('/' + path + '/read_data'), params).then(res => res.data)
  },
  getUploadFileUrl(params) {
    return $http.get(url('/file/getUrl'), params).then(res => res.data)
  }
};
